package cn.xo68.boot.auth.server.service;

import java.util.List;

import cn.xo68.boot.auth.server.domain.OauthRole;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import cn.xo68.boot.auth.server.mapper.OauthRoleMapper;



/** 
 * OauthRole Service
 * @author wuyy(16349023@qq.com)
 * @date 2018年08月28日 11:04:12
 *
 */
 @Service
public class OauthRoleService{
    @Autowired
    private OauthRoleMapper oauthRoleMapper;

    public OauthRole get(String roleId) {
        return  oauthRoleMapper.get(roleId);
    }

    public void insert(OauthRole oauthRole) {
        oauthRoleMapper.insert(oauthRole);
    }

    public void update(OauthRole oauthRole) {
        oauthRoleMapper.update(oauthRole);
    }
    
    public void delete(String roleId) {
        oauthRoleMapper.delete(roleId);
    }
    
    public List<OauthRole> list() {
        return oauthRoleMapper.list();
    }
	
	public PageInfo<OauthRole> list(int pageNumber,int pageSize) {
        PageHelper.startPage(pageNumber, pageSize,true);
        List<OauthRole> docs = oauthRoleMapper.list();
        PageInfo<OauthRole> pageInfo = new PageInfo<>(docs);
        return pageInfo;
    }
}